Euclidean Algorithm (Recursive) Demo
a:
b:
Generate
Previous
Next
Play
Speed:
1x
2x
4x
gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)